﻿//when page initialization is done
//$(document).ready(function () {
//    $('#textBoxDateFilter').datepicker();    
//});

function Filter(pageNumber, pageSize, category, title, description, date) {
    this.pageNumber = pageNumber;
    this.pageSize = pageSize;
    this.category = category;
    this.title = title;
    this.description = description;
    this.date = date
}

/****************************************/
/***************  CALL 1  ***************/
function GetPageofArticlesByCriteria(pageNumber, pageSize, category, title, description, date) {

    //Date.now().setUTCHours(this.getUTCHours() - 12)
    var d = new Date();
    var sd = d.getFullYear().toString() + " " + (d.getMonth() + 1).toString() + " " +
                (d.getDay() + 1).toString() + " " + d.getHours().toString() + " " +
                d.getMinutes().toString() + " " + d.getSeconds().toString();
    filter1 = new Filter('1', '12', 'actual', 't', '', sd);

    //    var sdate = document.getElementById('textBoxDateFilter').value;
    //    myDate = sdate.getFullYear().toString() + " " + (sdate.getMonth() + 1).toString() + " " +
    //                (sdate.getDay() + 1).toString() + " " + sdate.getHours().toString() + " " +
    //                sdate.getMinutes().toString() + " " + sdate.getSeconds().toString();

    filter2 = new Filter(pageNumber, pageSize, category, title, description, date);

    //        document.getElementById('textBoxPageNumber').value,
    //        document.getElementById('textBoxPageSize').value,
    //        document.getElementById('textBoxCategoryFilter').value,
    //        document.getElementById('textBoxTitleFilter').value,
    //        document.getElementById('textBoxDescriptionFilter').value,
    //        document.getElementById('textBoxDateFilter').value);

    PageMethods.GetPageofArticlesByCriteriaWS(filter2, onSuccessGetPageofArticlesByCriteriaWS, onCallError);
};


function onSuccessGetPageofArticlesByCriteriaWS(response) {
    //alert("-GetPagedArticles- called successfully !");    
    $("#resultList").html(format3Table(response));
    setEvents();
};


